// 校验的包
const Joi = require("joi");

// 定义校验规则
const username = Joi.string().alphanum().min(1).max(10).required();
const password = Joi.string()
  .pattern(/^[\S]{6,12}$/)
  .required();
const nickname = Joi.string().required();
const email = Joi.string().email().required();
const id = Joi.string().required();
const avatar = Joi.string().dataUri().required();
exports.login_schema = {
  body: {
    username,
    password,
  },
};
exports.update_userinfo_schema = {
  body: {
    id,
    nickname,
    email,
  },
};
exports.update_userpic_schema = {
  body: {
    avatar,
  },
};
